package cn.starrysky108.simpleerp.core.util;

/**
 * @author Carl Lee
 */
public class StringUtil {
    private static final char[] HEX_CODE = "0123456789ABCDEF".toCharArray();

    /**
     * HEX编码
     */
    public static String toHexString(byte[] data) {
        StringBuilder r = new StringBuilder(data.length * 2);
        for (byte b : data) {
            r.append(HEX_CODE[(b >> 4) & 0xF]);
            r.append(HEX_CODE[(b & 0xF)]);
        }
        return r.toString();
    }
}
